<?php

namespace app\admin\library;

class Broker extends \Jasny\SSO\Broker
{
    public function __construct($cookie_lifetime = 3600)
    {
        parent::__construct(config('sso.server'), config('sso.broker_id'), config('sso.broker_secret'), $cookie_lifetime);
    }

    public function getAccessToken()
    {
        return $this->getSessionId();
    }

    public function logout()
    {
        $data = $this->request('POST', 'logout', 'logout');
        if ($data && isset($data['success']) && $data['success']) {
            $this->clearToken();
        }
    }
}